package com.syedu.day16;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.PrintWriter;

/**
 * description：利用字符流混淆CSS代码
 * @author Administrator
 * @date 2022/4/7 14:38
 */
public class MixCodeDemo {
    public static void main(String[] args) {
        try (BufferedReader reader = new BufferedReader(new FileReader("typebase.css"));
             PrintWriter writer = new PrintWriter("typebase.min.css")) {
            String line = null;
            boolean flag = true;
            while ((line = reader.readLine()) != null) {
                //除去前后空白
                line = line.trim();
                //判断注释
                if (line.startsWith("/*")) {
                    flag = false;
                }
                if (line.endsWith("*/")) {
                    flag = true;
                    continue;
                }
                if (flag) {
                    writer.print(line);
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}